package com.zsck.pos.utils;

import android.util.Log;

import com.chinaums.commoncheck.BuildConfig;
import com.zsck.pos.common.Constants;

public class LogUtil {
    public static void i(String tag,String msg) {
        if(BuildConfig.LOG_DEBUG)  if (Constants.LOG_FLAG){
            if (tag == null || tag.length() == 0
                    || msg == null || msg.length() == 0)
                return;

            int segmentSize = 3 * 1024;
            long length = msg.length();
            if (length <= segmentSize ) {// 长度小于等于限制直接打印
                Log.i(tag, msg);
            }else {
                while (msg.length() > segmentSize ) {// 循环分段打印日志
                    String logContent = msg.substring(0, segmentSize );
                    msg = msg.replace(logContent, "");
                    Log.i(tag, logContent);
                }
                Log.i(tag, msg);// 打印剩余日志
            }




//        Log.i(tag, tag+"----------->>>" + s);
        }
    }
    public static void d(String tag,String s){
        if(BuildConfig.LOG_DEBUG) if (Constants.LOG_FLAG){
        Log.d(tag+"----------->>>",s);
        }
    }
    public static void w(String tag,String s){
        if(BuildConfig.LOG_DEBUG)   if (Constants.LOG_FLAG){
            Log.w(tag+"----------->>>",s);
        }
    }
    public static void e(String tag,String s){
        if(BuildConfig.LOG_DEBUG)  if (Constants.LOG_FLAG){
            Log.e(tag+"----------->>>","" + s);
        }
    }
}
